/**
 * 
 */
package com.ubo.java.model.classifier;


import com.ubo.java.model.IType;
import com.ubo.transform.java.IJavaVisitor;

/**
 * @author saludegu
 * 
 */
public class ArrayType implements IType {

	/**
	 * Type du tableau.
	 */
	protected final IType mType;

	/**
	 * Taille du tableau.
	 */
	protected int mSize;

	/**
	 * 
	 * Constructor
	 * 
	 * @param type
	 * @param size
	 */
	public ArrayType(IType type, int size) {
		mType = type;
		mSize = size;
	}

	/**
	 * @see com.ubo.transform.java.IJavaGenerable#generate(com.ubo.transform.java.IJavaVisitor)
	 */
	@Override
	public void generate(IJavaVisitor<?> generator) {
		generator.generate(this);
	}

	/**
	 * @return the mType
	 */
	public IType getType() {
		return mType;
	}

	/**
	 * @return the mSize
	 */
	public int getSize() {
		return mSize;
	}

	/**
	 * 
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return mType.toString() + "[" + mSize + "]";
	}

	/**
	 * @see com.ubo.java.model.IType#generationNeeded()
	 */
	@Override
	public boolean generationNeeded() {
		return true;
	}
}
